{% extends "projects/project_edit_base.html" %}

{% load i18n %}

{% block title %}{% trans "Edit Domains" %}{% endblock %}

{% block nav-dashboard %} class="active"{% endblock %}

{% block editing-option-edit-proj %}class="active"{% endblock %}

{% block project-domains-active %}active{% endblock %}

{% block project_edit_content_header %}

{% if domain %}
{% trans "Domain Details" %}
{% else %}
{% trans "Create Domain" %}
{% endif %}

{% endblock %}

{% block project_edit_content %}
  {% if domain.domainssl %}
    {# This references optional code to get the SSL certificate status #}
    <p>
      <strong>{% trans 'SSL certificate status' %}: </strong>
      <span>{{ domain.domainssl.status }}</span>
    </p>
    {% if domain.domainssl.status == 'pending_validation' %}
      <p class="help_text"><small>{% trans 'Did you setup a CNAME record in DNS pointing at "readthedocs.io"?' %}</small></p>
    {% endif %}
  {% endif %}

  {% if domain %}
    {% url 'projects_domains_edit' project.slug domain.pk as action_url %}
  {% else %}
    {% url 'projects_domains_create' project.slug as action_url %}
  {% endif %}
  <form method="post" action="{{ action_url }}">{% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="{% trans "Save Domain" %}">
    {% if domain.domainssl %}
      <p class="help-block">{% trans 'Saving the domain will revalidate the SSL certificate' %}</p>
    {% endif %}
  </form>
{% endblock %}
